package com.finley.flowabledemo.controller;


import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLCServer;

/**
 * @description:
 * @author: xianfei.chao
 * @date 2025/7/3 13:41
 * @version: 1.0
 */
public class S7PlcServerDemo {

    public static void main(String[] args) {
        // 创建服务端
        S7PLCServer server = new S7PLCServer();
        server.addDBArea(2, 3, 4);
        server.start();

        // 创建客户端
        S7PLC s7PLC = new S7PLC(EPlcType.S1200);
        s7PLC.writeInt16("DB2.0", (short)99);
        short b = s7PLC.readInt16("DB2.0");
        System.out.println("data:" + b);
        // 关闭
        s7PLC.close();
        server.stop();
    }
}
